using System;
using System.Collections.Generic;

namespace Expect.Core.Interfaces
{
    /// <summary>
    /// Service contract for the specifications execution context
    /// </summary>
    public interface IExecutionContext
    {
        /// <summary>
        /// Summary of the execution result
        /// </summary>
        ExecutionSummary Summary { get; set; }

        /// <summary>
        /// execution container
        /// </summary>
        object Container { get; set; }

        /// <summary>
        /// Context data
        /// </summary>
        Dictionary<string, object> Data { get; }

        /// <summary>
        /// Indexer on data
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        object this[string name] { get; set; }

        /// <summary>
        /// Indicate if context data contains this element
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool HasDataFor(string name);

        /// <summary>
        /// Name provider for the resolution of the names
        /// </summary>
        INameProvider NameProvider { get; set; }

        /// <summary>
        /// Catalog of specs and fixtures implementations
        /// </summary>
        IExpectCatalog Catalog { get; set; }

        /// <summary>
        /// Indicate if the context must only resolve specifications and consequently not execute them
        /// </summary>
        bool ResolveOnly { get; set; }

        /// <summary>
        /// Get a setup specification from named specification container
        /// </summary>
        /// <param name="spec"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        SpecificationDefinition GetSetupFrom(SpecificationDefinition spec, string name);

        /// <summary>
        /// Get a teardown specification from named specification container
        /// </summary>
        /// <param name="spec"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        SpecificationDefinition GetTeardownFrom(SpecificationDefinition spec, string name);
    }
}